package cn.bdqn.appinfo.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.bdqn.appinfo.entity.User;
import cn.bdqn.appinfo.util.Result;

@Controller
public class LogoutController {
	@RequestMapping("/logout")
	@ResponseBody
	public Result logout(HttpSession session) {
		System.out.println("logout:" + session.getId());
		User user = (User) session.getAttribute("loginUser");
		System.out.println("user:" + user.getUsername());
		session.invalidate();
		return Result.ok();
	}
}
